package twelfth.操作文件的类_File.列出指定目录的全部文件;

import java.io.File;

public class 使用listFiles方法列出一个目录中的全部内容 {
    public static void main(String[] args) {
        File f = new File("d:" + File.separator + "WorkSpaces" + File.separator);
        File[] files = f.listFiles();
        for (File file:files){
            System.out.println(file);
        }
    }
}
/*
D:\WorkSpaces\Java\jdk-21\bin\java.exe "-javaagent:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\lib\idea_rt.jar=53635:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath D:\WorkSpaces\JavaDevelopBase_start_329\out\production\JavaDevelopBase_start_329 twelfth.操作文件的类_File.列出指定目录的全部文件.使用listFiles方法列出一个目录中的全部内容
d:\WorkSpaces\apache-maven-3.9.5-bin
d:\WorkSpaces\ComputerEnglishDaydayup
d:\WorkSpaces\dnSpy
d:\WorkSpaces\EA工程文件
d:\WorkSpaces\EclipseWorkspace
d:\WorkSpaces\ExteriorSource
d:\WorkSpaces\GitSpace
d:\WorkSpaces\HTML
d:\WorkSpaces\Jakarta_JAR
d:\WorkSpaces\Java
d:\WorkSpaces\JavaDevelopBase_start_329
d:\WorkSpaces\JavaWebStudy
d:\WorkSpaces\jupyterFile
d:\WorkSpaces\LearningSpring
d:\WorkSpaces\logs
d:\WorkSpaces\maven-mvn-repositories
d:\WorkSpaces\MySQL8.0.36
d:\WorkSpaces\nvm
d:\WorkSpaces\Pyproject
d:\WorkSpaces\Redis
d:\WorkSpaces\setting-xml
d:\WorkSpaces\TomcatSpace
d:\WorkSpaces\VisualSVN-Server-Repositories
d:\WorkSpaces\VueSpace
d:\WorkSpaces\WebStormSpace
d:\WorkSpaces\WebStrom-Help-webide.vmoptions.txt
d:\WorkSpaces\激活码2.txt

Process finished with exit code 0
 */